struct ListNode* removeDuplicateNodes(struct ListNode* head) {
    if (head == NULL || head->next == NULL)
        return head;
    struct ListNode* temp = head;
    while (temp)
    {
        struct ListNode* temp2 = temp->next;
        struct ListNode* prev = temp;
        while (temp2)
        {
            if (temp2->val == temp->val)
            {
                prev->next = temp2->next;
                temp2 = temp2->next;
            }
            else
            {
                prev = temp2;
                temp2 = temp2->next;
            }

        }
        temp = temp->next;
    }
    return head;
}